package com.mingxun.project;

import android.content.Context;

import com.blankj.utilcode.util.Utils;
import com.mingxun.project.http.TokenHeaderHelper;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.tinker.loader.app.TinkerApplication;
import com.tencent.tinker.loader.shareutil.ShareConstants;

/**
 * class name：
 *
 * @author lhy@shikee.tv
 * @date 2018/7/4
 */

public class MyApplication extends TinkerApplication {
    protected boolean shouldReplace = false;
    private static MyApplication ourInstance;
    private static Context mContext;

    public MyApplication() {
        super(ShareConstants.TINKER_ENABLE_ALL, "com.mingxun.project.SampleApplicationLike",
                "com.tencent.tinker.loader.TinkerLoader", false);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        ourInstance = this;
        mContext = getApplicationContext();
        Utils.init(this);
        TokenHeaderHelper.get().init(this);
        Bugly.setIsDevelopmentDevice(getApplicationContext(), false);
        CrashReport.initCrashReport(getApplicationContext(), "9abf120b41", true);
        CrashReport.setUserId(this,"18570621793");
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
    }

    @Override
    public void onTrimMemory(int level) {
        super.onTrimMemory(level);
    }

    public static MyApplication getInstance() {
        return ourInstance;
    }

    public static Context getContext() {
        return mContext;
    }

    public boolean isShouldReplace() {
        return shouldReplace;
    }

    public void setShouldReplace(boolean shouldReplace) {
        this.shouldReplace = shouldReplace;
    }
}
